<style lang="sass" scoped>

</style>
<template>
    <div v-jurdie="'book2200'" class="container pd15">
        <div class="common_block">
            <div class="head head-default">运费规则设置</div>
            <div class="contener">
                <el-form label-width="100px">
                    <el-form-item label="运费金额：" prop="xxx">
                        <el-input v-model.trim="postObj.carriageFee"></el-input>
                    </el-form-item>
                    <el-form-item label="包邮金额：" prop="xxx">
                        <el-input v-model.trim="postObj.freeCondition"></el-input>
                    </el-form-item>
                    <el-form-item label="运费说明：" prop="xxx">
                        <el-input v-model.trim="postObj.desc" type="textarea" autosize></el-input>
                    </el-form-item>
                    <el-form-item label="" prop="xxx">
                        <el-button v-jurdie="'book2201'" @click="modifyCarriageFeeRule()" type="primary">保存</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>
<script>
    export default {
        components: {
        },
        data() {
            return {
                postObj:{
                    carriageFee:'',//	Y	string	运费
                    freeCondition:'',//	Y	string	包邮金额
                    desc:'',//	Y	string	运费说明
                }
            };
        },
        watch:{
            'search.status'(val){
            }
        },
        created(){
            
        },
        mounted() {
            this.$nextTick(() => {
                this.getInfo();
            });
        },
        methods: {
            getInfo(){
                let param = JSON.parse(JSON.stringify(this.postObj));
                util.ajax({
                    url:config.baseApi + 'bookMall-admin/api/home/getCarriageFeeRule',
                    data:param,
                    success:(data=>{
                        data.data.desc = data.data.desc.replace(/\<br\>/g,"\n");
                        this.postObj = data.data;
                    })
                })
            },
            modifyCarriageFeeRule(){
                let param = JSON.parse(JSON.stringify(this.postObj));
                param.desc = param.desc.replace(/\n/g,"<br>");
                util.ajax({
                    url:config.baseApi + 'bookMall-admin/api/home/modifyCarriageFeeRule',
                    data:param,
                    success:(data=>{
                        popup.miss({content:'操作成功！'});
                    })
                })
            }
        },
        
    };
</script>